package demo3;

public class ExchangeTest2 {
    public static void main(String[] args) {
        MyValue v1 = new MyValue();
        MyValue v2 = new MyValue();

        v1.value = 2;
        v2.value = 3;

        swap(v1, v2);

        System.out.println(v1.value + " " + v2.value);
    }

    public static void swap(MyValue v1, MyValue v2) {

        int temp = v1.value;
        v1.value = v2.value;
        v2.value = temp;

//        MyValue temp = v1;
//        v1 = v2;
//        v2 = temp;
    }
}
